package com.netvine.iias;

import com.netsdk.lib.NetSDKLib;

public enum HKCommand {
    UP(HCNetSDK.TILT_UP),
    DOWN(HCNetSDK.TILT_DOWN),
    LEFT(HCNetSDK.PAN_LEFT),
    RIGHT(HCNetSDK.PAN_RIGHT),
    UPLEFT(HCNetSDK.UP_LEFT),
    UPRIGHT(HCNetSDK.UP_RIGHT),
    DOWNLEFT(HCNetSDK.DOWN_LEFT),
    DOWNRIGHT(HCNetSDK.DOWN_RIGHT),
    ZOOMIN(HCNetSDK.ZOOM_IN),
    ZOOMOUT(HCNetSDK.ZOOM_OUT),
    SETPRESET(HCNetSDK.SET_PRESET),
    GOTOPRESET(HCNetSDK.GOTO_PRESET);

    private final int commandCode;

    HKCommand(int commandCode) {
        this.commandCode = commandCode;
    }

    public int getCommandCode() {
        return commandCode;
    }

    public static int getHKCommandCode(String command) {
        try {
            return HKCommand.valueOf(command).getCommandCode();
        } catch (IllegalArgumentException e) {
            return -1; // 如果命令无效，返回 -1
        }
    }
}
